﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZeroMQ;

namespace Client
{
    class Program
    {
        static void Main(string[] args)
        {
            // http://code.google.com/p/transaq-for-net/

            var subscriber = new ZmqSubscribeSocket();

            subscriber.Bind("tcp://127.0.0.1:9292");

            subscriber.Subscribe(prefix: ""); // subscribe to all messages

            // Add a handler to the subscriber's OnReceive event
            while (true)
            {
                subscriber.OnReceive += () =>
                {
                    String message;
                    subscriber.Receive(out message, nonblocking: true);

                    Console.WriteLine(message);
                    Console.WriteLine();
                    System.Threading.Thread.Sleep(100);
                };
            }
        }
    }
}
